package com.softer.wxzj.controller;


import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.aop.annotation.LogRecord;
import com.softer.wxzj.common.aop.enums.LogOperationType;
import com.softer.wxzj.common.aop.enums.LogOperationUnit;
import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.entity.SysCoreParam;
import com.softer.wxzj.service.SysCoreParamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * FlowTypeController class
 * @author wxr
 * @date 2019/4/10
 */
@RestController
@RequestMapping("/syscoreparam")
@Slf4j
public class SysCoreParamController {
    @Autowired
    SysCoreParamService syscoreparamService;
    @RequestMapping("/update")
    @LogRecord(description = "系统参数修改",operationUnit = LogOperationUnit.SYS_CORE_PARAM,operationType = LogOperationType.UPDATE)
    public CommonResult update(SysCoreParam f) {
        return syscoreparamService.update(f);
    }
    @RequestMapping("/delete")
    @LogRecord(description = "系统参数删除",operationUnit = LogOperationUnit.SYS_CORE_PARAM,operationType = LogOperationType.DELETE)
    public CommonResult delete(String id) {
        return syscoreparamService.delete(id);
    }
    @RequestMapping("/getList")
    @LogRecord(description = "系统参数查询",operationUnit = LogOperationUnit.SYS_CORE_PARAM,operationType = LogOperationType.SELECT)
    public PageInfo<SysCoreParam> getList(Page page, SysCoreParam f) {
        return syscoreparamService.getList(page,f);
    }
    @RequestMapping("/getInfo")
    @LogRecord(description = "系统参数详情",operationUnit = LogOperationUnit.SYS_CORE_PARAM,operationType = LogOperationType.SELECT)
    public SysCoreParam getInfo(String id){
        return syscoreparamService.getInfo(id);
    }

    @RequestMapping("/fuzzySearch")
    @LogRecord(description = "系统参数",operationUnit = LogOperationUnit.ROLE,operationType = LogOperationType.SELECT)
    public PageInfo<SysCoreParam> fuzzySearch(Page page, String fuzzy,String paramType) {
        return syscoreparamService.fuzzySearch(page,fuzzy,paramType);
    }

    /**
     * 根据ParamCode查询SysCoreParam
     * @param paramCode
     * @return
     */
    @RequestMapping("/getParamByParamCode")
    @LogRecord(description = "根据ParamCode查询SysCoreParam",operationUnit = LogOperationUnit.ROLE,operationType = LogOperationType.SELECT)
    public String getParamByParamCode(String paramCode) {
        return syscoreparamService.getParamByParamCode(paramCode);
    }
}
